package test.spring;

import java.util.List;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.convert.support.ConfigurableConversionService;

public class ConversionServiceBuilder implements InitializingBean {

	private ConfigurableConversionService conversionService;
	private List<IConverterRegistry> converterRegistries;

	@Override
	public void afterPropertiesSet() throws Exception {
		for (IConverterRegistry registry : converterRegistries) {
			registry.register(conversionService);
		}

	}

	/**
	 * @param conversionService
	 *            the conversionService to set
	 */
	public void setConversionService(ConfigurableConversionService conversionService) {
		this.conversionService = conversionService;
	}

	/**
	 * @param converterRegistries the converterRegistries to set
	 */
	public void setConverterRegistries(List<IConverterRegistry> converterRegistries) {
		this.converterRegistries = converterRegistries;
	}

}
